Set Field Values

Set Field Values for Logged-In User

Description
Set the value of a field based on the identity of the currently logged-in user.
Variables
Record Control Class
Select the record control where this customization will be inserted
Field Name Control
Select the field whose value needs to be set.
Applies to
RecordControl class
Code
 
''' 
''' Override the Databind() method, call the MyBase DataBind() and 
''' set the value of a field based on the identity of the currently
''' logged-in user.
''' 
Public Overrides Sub DataBind()

    ' Call myBase.DataBind()
    MyBase.DataBind()
    
    ' If the user is logged-in set the text of the control
    ' equal to the loginId
    If Not (Me.Page.CurrentSecurity.GetUserStatus() = "")  Then    
        Me.${Field Name Control}.Text = "Created by: " & Me.Page.CurrentSecurity.GetUserStatus()
    Else    
        Me.${Field Name Control}.Text = "Not Signed In"        
    End If 
End Sub
     

Terms of Service Privacy Statement